package com.omar.labs.tamtamy.XML;

import java.util.ArrayList;

import com.omar.labs.tamtamy.ContentLink;
import com.omar.labs.tamtamy.TagList;
import com.omar.labs.tamtamy.UserDetail;
import com.omar.labs.tamtamy.utils.XMLUtility;

public class XMLUserDetail extends UserDetail {

	public XMLUserDetail(String xml) {	
		this.userID = XMLUtility.getNodeValue(xml, "userID");
		this.nickname = XMLUtility.getNodeValue(xml, "nickname");
		this.firstName = XMLUtility.getNodeValue(xml, "firstName");
		this.lastName = XMLUtility.getNodeValue(xml, "lastName");
		this.birthday = XMLUtility.getNodeValueWithAttribute(xml, "birthday", "class=\"sql-timestamp\"");
		this.gender = XMLUtility.getNodeValue(xml, "gender");
		this.diskQuotaLimit = XMLUtility.getNodeValue(xml, "diskQuotaLimit");
		this.company = XMLUtility.getNodeValue(xml, "company");
		this.mail = XMLUtility.getNodeValue(xml, "mail");
		this.jabberMessenger = XMLUtility.getNodeValue(xml, "jabberMessenger");
		this.msnMessenger = XMLUtility.getNodeValue(xml, "msnMessenger");
		this.instantMessenger = XMLUtility.getNodeValue(xml, "instantMessenger");
		this.blog = XMLUtility.getNodeValue(xml, "blog");
		this.interest = XMLUtility.getNodeValue(xml, "interest");
		this.avatarFilename = XMLUtility.getNodeValue(xml, "avatarFilename");
		this.online = Boolean.parseBoolean(XMLUtility.getNodeValue(xml, "onLine"));
		this.department = XMLUtility.getNodeValue(xml, "department");	
		String tmpContentList = XMLUtility.getNodeValue(xml, "contentList");
		this.contentList = XMLContentList.getContentListIDs(tmpContentList, "long");
		this.tagList = new XMLTagList(xml);
	}

}
